using Since.Netcode;
using UnityEngine;

public class EnemyAuthority : INetworkAuthority<Enemy>
{
	public override void Update()
	{
		if (owner.transform.position.y < 0)
		{
			owner.CallDespawnServerRpc();
		}

	}

	public override void OnNetworkSpawn()
	{
		base.OnNetworkSpawn();
		
		owner.GetComponent<NetcodeTransform>().SetVelocity(new Vector3(0,Random.Range(-3,-10) , 0));
	}
	
	public override void OnNetworkDespawn()
	{
		Battle.Instance.NowLevel.CurNum--;
	}
}
